﻿/*
 ***************************************************************************
 * Microsoft Visual C# .NET
 * 名称：       App_Input_PersonBonusPenaltyUpdForm
 * 类型：       控制层
 * 功能说明：   奖惩申请编辑页面
 * 作者：       徐傲明
 * 创建日期：   2008/3/13
 * 修改日期     修改者      修改内容
 * 
 * 
 * ---
 ***************************************************************************
*/

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Input.Dao;
using Shpm.App.Input.Bean;
using Shpm.App.Commons.Db.Beans.Master;
using Shpm.System;
using log4net;
using Shpm.App.Commons.Utils;
using Shpm.System.Validator;
using Shpm.System.Web.Control;
using Shpm.App.Master.Dao;
using Shpm.App.Master.Bean;

public partial class App_Input_PersonBonusPenaltyUpdForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


        if (!Page.IsPostBack)
        {
            

            setPageControls();

            //接收页面传递参数
            if (Context.Items["PERSON_ID"] != null)
            {
                ViewState["PERSON_ID"] = Context.Items["PERSON_ID"];

            }
            else
            {
                ViewState["PERSON_ID"] = null;
            }
            if (Context.Items.Contains("URL"))
            {
                ViewState["URL"] = Convert.ToString(Context.Items["URL"]);
            }
            if (Context.Items.Contains("CMB_GROUP_ID"))
            {
                this.ViewState["CMB_GROUP_ID"] = Context.Items["CMB_GROUP_ID"];
            }
            if (Context.Items.Contains("CMB_JOB_ID"))
            {
                this.ViewState["CMB_JOB_ID"] = Context.Items["CMB_JOB_ID"];
            }
            if (Context.Items.Contains("CMB_STATUS_ID"))
            {
                this.ViewState["CMB_STATUS_ID"] = Context.Items["CMB_STATUS_ID"];
            }
            if (Context.Items.Contains("EMPLOYEE_STATUS"))
            {
                this.ViewState["EMPLOYEE_STATUS"] = Context.Items["EMPLOYEE_STATUS"];
            }
            if (Context.Items.Contains("CMB_EMPLOYEE_ID"))
            {
                this.ViewState["CMB_EMPLOYEE_ID"] = Context.Items["CMB_EMPLOYEE_ID"];
            }
            if (Context.Items.Contains("CMB_EMPLOYEE_NAME"))
            {
                this.ViewState["CMB_EMPLOYEE_NAME"] = Context.Items["CMB_EMPLOYEE_NAME"];
            }





            if (this.Context.Items.Contains("ROW_ID") && !string.IsNullOrEmpty(Convert.ToString(Context.Items["ROW_ID"])))
            {
                this.ViewState["ROW_ID"] = Convert.ToString(this.Context.Items["ROW_ID"]);
            }
            else
            {
                this.ViewState["ROW_ID"] = null;
            }
            if (this.Context.Items.Contains("EMPLOYEE_ID") && !string.IsNullOrEmpty(Convert.ToString(Context.Items["EMPLOYEE_ID"])))
            {
                this.ViewState["EMPLOYEE_ID"] = Convert.ToString(this.Context.Items["EMPLOYEE_ID"]);
                string ss = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            }
            else
            {
                this.ViewState["EMPLOYEE_ID"] = null;
            }
            if (this.Context.Items.Contains("ParamPageIndex"))
            {
                this.ViewState["ParamPageIndex"] = Convert.ToString(this.Context.Items["ParamPageIndex"]);
            }

        }

    }

    void Page_PreRender(object sender, EventArgs e)
    {       
        PersonBonusPenaltyBean bean = new PersonBonusPenaltyBean();
        PersonBonusPenaltyDao dao = new PersonBonusPenaltyDao();
        SysUserManager manager = new SysUserManager(Context);
        string userId = manager.getSysUserBean().getMstSysUserBean().SysUserId;

        //编辑时
        if (!string.IsNullOrEmpty(Convert.ToString(this.ViewState["ROW_ID"])))
        {
            loadDate();
        }
        //新建时
        else
        {
            bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            bean = dao.GetEmployeeName(bean);
            labelName.Text = bean.EmployeeName;
            rdoCancel.Enabled = false;
            rdoOk.Enabled = false;
            txtAuditing.ReadOnly = true;
            btnAmount.Enabled = false;
        }
           
    }


    /*名称： setPageControls
     *功能： 数据加载
     *参数： 无
     *返回： 无
     *说明： 无
     */
    public void loadDate()
    {
        PersonBonusPenaltyBean bean = new PersonBonusPenaltyBean();
        PersonBonusPenaltyDao dao = new PersonBonusPenaltyDao();
        SysUserManager manager = new SysUserManager(Context);
        string userId = manager.getSysUserBean().getMstSysUserBean().SysUserId;
        bean.RowId = Convert.ToInt32(this.ViewState["ROW_ID"]);
        bean = dao.GetPersonBonusPenalty(bean);

        //------访问人为提交人或审批人时-----//
        if (Convert.ToString(bean.CommitId) == userId || Convert.ToString(bean.AuditingId) == userId)
         {
              if (bean.AuditingFlg == 1 || bean.CancelFlg == 1)//通过或撤消时
              {
                    rdoCancel.Enabled = false;
                    rdoOk.Enabled = false;
                    btnAmount.Enabled = false;
                    btnBack.Enabled = true;
                    btnSubmit.Enabled = false;
                    btnSave.Enabled = false;
                    txtCommit.ReadOnly = true;
                    txtAuditing.ReadOnly = true;
                    txtTime.ReadOnly = true;
                    txtAmount.ReadOnly = true;
                    bonusPenalty.Enabled = false;
                    dropCheckEmp.Enabled = false;
              }
              else//非通过或撤消时
              {
                    if (Convert.ToString(bean.CommitId) == userId && Convert.ToString(bean.AuditingId) != userId)//访问人为提交人时
                    {
                        if (bean.CommitFlg == 0)//提交中
                        {
                            rdoCancel.Enabled = false;
                            rdoOk.Enabled = false;
                            btnAmount.Enabled = false;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = true;
                            btnSave.Enabled = true;
                            txtCommit.Enabled = true;
                            txtAuditing.ReadOnly = true;
                        }
                        else//非提交中
                        {
                            rdoCancel.Enabled = false;
                            rdoOk.Enabled = false;
                            btnAmount.Enabled = false;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = false;
                            btnSave.Enabled = false;                            
                            dropCheckEmp.Enabled = false;                           
                            bonusPenalty.Enabled = false;
                            dropCheckEmp.Enabled = false;
                            txtCommit.ReadOnly = true;
                            txtAuditing.ReadOnly = true;
                            txtTime.ReadOnly = true;
                            txtAmount.ReadOnly = true;
                        }
                    }
                    else if (Convert.ToString(bean.CommitId) != userId && Convert.ToString(bean.AuditingId) == userId)//访问人为审批人时
                    {
                        if (bean.CommitFlg == 0)//提交中
                        {
                            rdoCancel.Enabled = false;
                            rdoOk.Enabled = false;
                            bonusPenalty.Enabled = false;
                            dropCheckEmp.Enabled = false;
                            btnAmount.Enabled = false;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = false;
                            btnSave.Enabled = false;
                            txtCommit.ReadOnly = true;
                            txtAuditing.ReadOnly = true;
                        }
                        else if (bean.CommitFlg == 1 && bean.AuditingFlg == 0 && bean.CancelFlg == 0)
                        {
                            rdoCancel.Enabled = true;
                            rdoOk.Enabled = true;
                            rdoOk.Checked = true;
                            bonusPenalty.Enabled = false;
                            dropCheckEmp.Enabled = false;
                            btnAmount.Enabled = true;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = false;
                            btnSave.Enabled = false;
                            txtCommit.ReadOnly = true;
                            txtAuditing.Enabled = true;
                            txtTime.ReadOnly = true;
                            txtAmount.ReadOnly = true;
                        }
                        else//非提交中
                        {
                            rdoCancel.Enabled = true;
                            rdoOk.Enabled = true;
                            rdoOk.Checked = true;
                            bonusPenalty.Enabled = false;
                            dropCheckEmp.Enabled = false;
                            btnAmount.Enabled = true;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = false;
                            btnSave.Enabled = false;
                            txtCommit.ReadOnly = true;
                            txtAuditing.Enabled = true;
                        }

                    }
                    else//访问人为提交人且审批人时
                    {
                        if (bean.CommitFlg == 0)//提交中
                        {
                            rdoCancel.Enabled = false;
                            rdoOk.Enabled = false;
                            btnAmount.Enabled = false;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = true;
                            btnSave.Enabled = true;
                            txtCommit.Enabled = true;
                            txtAuditing.ReadOnly = true;
                        }
                        else//非提交中
                        {
                            rdoCancel.Enabled = true;
                            rdoOk.Enabled = true;
                            rdoOk.Checked = true;
                            btnAmount.Enabled = true;
                            btnBack.Enabled = true;
                            btnSubmit.Enabled = false;
                            btnSave.Enabled = false;
                            txtCommit.ReadOnly = true;
                            txtAuditing.Enabled = true;
                            txtAuditing.ReadOnly = false;
                            bonusPenalty.Enabled = false;
                            dropCheckEmp.Enabled = false;
                            txtTime.ReadOnly = true;
                            txtAmount.ReadOnly = true;
                        }
                    }
                }

                //置页面数据
                labelName.Text = bean.EmployeeName;
                bonusPenalty.SelectedValue = bean.HortationType;
                txtTime.Text = DateUtils.convertToString((DateTime)bean.BeginDate);
                txtAmount.Text = string.Format("{0:N}", bean.Amount);
                dropCheckEmp.SelectedValue = bean.AuditingId;
                txtCommit.Text = bean.CommitMemo;
                txtAuditing.Text = bean.AuditingMemo;
                if (bean.AuditingFlg == 1)
                {
                    rdoOk.Checked = true;

                }
                else if (bean.CancelFlg == 1)
                {
                    rdoCancel.Checked = true;
                }
            }
            //-----访问人为不是提交人也不是审批人时------//
            else
            {

                rdoCancel.Enabled = false;
                rdoOk.Enabled = false;
                btnAmount.Enabled = false;
                btnBack.Enabled = true;
                btnSubmit.Enabled = false;
                btnSave.Enabled = false;
                dropCheckEmp.Enabled = false;
                txtCommit.ReadOnly = true;
                txtAuditing.ReadOnly = true;
                txtTime.ReadOnly = true;
                txtAmount.ReadOnly = true;
                bonusPenalty.Enabled = false;
                dropCheckEmp.Enabled = false;

                //置页面数据
                labelName.Text = bean.EmployeeName;
                bonusPenalty.SelectedValue = bean.HortationType;
                txtTime.Text = DateUtils.convertToString((DateTime)bean.BeginDate);
                txtAmount.Text = string.Format("{0:N}", bean.Amount);
                dropCheckEmp.SelectedValue = bean.AuditingId;
                txtCommit.Text = bean.CommitMemo;
                txtAuditing.Text = bean.AuditingMemo;
                if (bean.AuditingFlg == 1)
                {
                    rdoOk.Checked = true;

                }
                else if (bean.CancelFlg == 1)
                {
                    rdoCancel.Checked = true;
                }
            }            
    }



    /*名称： setPageControls
     *功能： 加载数据字典
     *参数： user
     *返回： 无
     *说明： 无
     */
    private void setPageControls()
    {
        CommonDictionaryDao dao = new CommonDictionaryDao();
        CommonDictionaryBean bean = new CommonDictionaryBean();

        //数据词典加载
        bean.Catalog = "M_EMPLOYEE_HORTATION.HORTATION_TYPE";
        IList list = dao.FindByCatalog(bean);
        //list.RemoveAt(0);
        //list.Insert(0, new CommonDictionaryBean());
        bonusPenalty.DataSource = list;
        bonusPenalty.DataBind();

        PersonBonusPenaltyBean personBonusPenaltyBean = new PersonBonusPenaltyBean();
         PersonBonusPenaltyDao personBonusPenaltyDao = new PersonBonusPenaltyDao();
        personBonusPenaltyBean.RowId = Convert.ToInt32(this.ViewState["ROW_ID"]);
        personBonusPenaltyBean = personBonusPenaltyDao.GetPersonBonusPenalty(personBonusPenaltyBean);

            //审核人列表
            SysUserManager manager = new SysUserManager(Context);
            SysUserBean sysUserBean = manager.getSysUserBean();
            MstSysUserBean mstSysUserBean =
                sysUserBean == null ? null : sysUserBean.getMstSysUserBean();
            MstEmployeeBean mstEmpBean =
                sysUserBean == null ? null : sysUserBean.getEmployeeBean();

            string loginId = mstSysUserBean == null ? "" : mstSysUserBean.SysUserId;
            string emplyId = mstSysUserBean == null ? "" : mstSysUserBean.EmployeeId;

            //检索部门编号
            PersonEmployeeBean employbean = new PersonEmployeeBean();
            EmployApplyDao employApplyDao = new EmployApplyDao();
            EmployeeDao employeeDao = new EmployeeDao();
            EmployeeBean employeeBean = new EmployeeBean();
            employeeBean.DepartId = "2";

            //检索提交对象
            list = employeeDao.FindCheckEmp(employeeBean);
            IList authorityList= new ArrayList();
            IEnumerator enm = list.GetEnumerator();
            while (enm.MoveNext())
            {
                EmployeeBean enmBean = (EmployeeBean)enm.Current;
                employbean.EmployeeId=enmBean.EmployeeId;
                employbean = employApplyDao.CheckAuthority(employbean);
                if (Convert.ToInt32(employbean.JobLimit) >= 3)
                {
                    authorityList.Add(enmBean);
                }

            }
            dropCheckEmp.DataSource = authorityList;
            dropCheckEmp.DataBind();
    }

    /*名称： btnSave_Click
     *功能： 保存
     *参数： 
     *返回： 无
     *说明： 无
     */
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ComValidateChecker validator = new ComValidateChecker();

        //数据验证
        validator.Add(new CheckRequired(txtTime.Text, new ComMessage("E0082", new string[] { "奖惩时间" })));
        validator.Add(new CheckDate(txtTime.Text, new ComMessage("E0037", "奖惩时间")));
        validator.Add(new CheckDateRange(DateUtils.convertToString(DateTime.Now.Date), txtTime.Text, new ComMessage("E0330", new string[] { "奖惩时间", "当前日期" })));
        validator.Add(new CheckDouble(txtAmount.Text, 9, 2, new ComMessage("E0036", new string[] { "金额" })));


        //验证没通过
        if (!validator.DoValidator())
        {
            ((Design_MasterPage)this.Master).InfoMessage = validator.ErrorMessage;
            return;
        }
        SysUserManager manager = new SysUserManager(Context);
        string userId = manager.getSysUserBean().getMstSysUserBean().SysUserId;
        PersonBonusPenaltyBean bean = new PersonBonusPenaltyBean();
        PersonBonusPenaltyDao dao = new PersonBonusPenaltyDao();

        //编辑时候
        if (!string.IsNullOrEmpty(Convert.ToString(this.ViewState["ROW_ID"])))
        {
            bean.RowId = Convert.ToInt32(this.ViewState["ROW_ID"]);
            bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            bean.BeginDate = Convert.ToDateTime(txtTime.Text);
            if (!string.IsNullOrEmpty(txtAmount.Text)) bean.Amount = Convert.ToDecimal(txtAmount.Text);
            bean.HortationType = bonusPenalty.SelectedValue;
            bean.CommitFlg = 0;
            bean.CommitId = userId;
            bean.CommitMemo = txtCommit.Text;
            bean.AuditingFlg = 0;
            bean.AuditingId = dropCheckEmp.SelectedValue;
            bean.AuditingMemo = txtAuditing.Text;
            bean.CancelFlg = 0;
            bean.UserId = userId;
            dao.UpdPersonBonusPenalty(bean);
        }
        //新建时候
        else
        {
            bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            bean.BeginDate = Convert.ToDateTime(txtTime.Text);
            if (!string.IsNullOrEmpty(txtAmount.Text)) bean.Amount = Convert.ToDecimal(txtAmount.Text);
            bean.HortationType = bonusPenalty.SelectedValue;
            bean.CommitFlg = 0;
            bean.CommitId = userId;
            bean.CommitMemo = txtCommit.Text;
            bean.AuditingFlg = 0;
            bean.AuditingId = dropCheckEmp.SelectedValue;
            bean.AuditingMemo = txtAuditing.Text;
            bean.CancelFlg = 0;
            bean.UserId = userId;
            int rowId = dao.InsertPersonBonusPenalty(bean);
            this.ViewState["ROW_ID"] = Convert.ToString(rowId);
        }

        //提示成功
        Response.Write("<script language=JavaScript>" +
                 "alert('" + HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0037").ToString().Replace("{0}", "保存") + "');</script>");


    }

    /*名称： btnSubmit_Click
     *功能： 提交
     *参数： 
     *返回： 无
     *说明： 无
     */
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ComValidateChecker validator = new ComValidateChecker();

        //数据验证
        validator.Add(new CheckRequired(txtTime.Text, new ComMessage("E0082", new string[] { "奖惩时间" })));
        validator.Add(new CheckDate(txtTime.Text, new ComMessage("E0037", "奖惩时间")));
        validator.Add(new CheckDateRange(DateUtils.convertToString(DateTime.Now.Date), txtTime.Text, new ComMessage("E0330", new string[] { "奖惩时间", "当前日期" })));
        validator.Add(new CheckDouble(txtAmount.Text, 9, 2, new ComMessage("E0036", new string[] { "金额" })));

        //验证没通过
        if (!validator.DoValidator())
        {
            ((Design_MasterPage)this.Master).InfoMessage = validator.ErrorMessage;
            return;
        }
        SysUserManager manager = new SysUserManager(Context);
        string userId = manager.getSysUserBean().getMstSysUserBean().SysUserId;
        PersonBonusPenaltyBean bean = new PersonBonusPenaltyBean();
        PersonBonusPenaltyDao dao = new PersonBonusPenaltyDao();

        //编辑时候
        if (!string.IsNullOrEmpty(Convert.ToString(this.ViewState["ROW_ID"])))
        {
            bean.RowId = Convert.ToInt32(this.ViewState["ROW_ID"]);
            bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            bean.BeginDate = Convert.ToDateTime(txtTime.Text);
            if (!string.IsNullOrEmpty(txtAmount.Text)) bean.Amount = Convert.ToDecimal(txtAmount.Text);
            bean.HortationType = bonusPenalty.SelectedValue;
            bean.CommitFlg = 1;
            bean.CommitId = userId;
            bean.CommitMemo = txtCommit.Text;
            bean.AuditingFlg = 0;
            bean.AuditingId = dropCheckEmp.SelectedValue;
            bean.AuditingMemo = txtAuditing.Text;
            bean.CancelFlg = 0;
            bean.UserId = userId;
            dao.UpdPersonBonusPenalty(bean);

        }
        //新建时候
        else
        {
            bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            bean.BeginDate = Convert.ToDateTime(txtTime.Text);
            //bean.Amount = !string.IsNullOrEmpty(txtAmount.Text) ?  Convert.ToDecimal(txtAmount.Text) : null;
            if (!string.IsNullOrEmpty(txtAmount.Text)) bean.Amount = Convert.ToDecimal(txtAmount.Text);
            bean.HortationType = bonusPenalty.SelectedValue;
            bean.CommitFlg = 1;
            bean.CommitId = userId;
            bean.CommitMemo = txtCommit.Text;
            bean.AuditingFlg = 0;
            bean.AuditingId = dropCheckEmp.SelectedValue;
            bean.AuditingMemo = txtAuditing.Text;
            bean.CancelFlg = 0;
            bean.UserId = userId;
            int rowId=dao.InsertPersonBonusPenalty(bean);
            this.ViewState["ROW_ID"] = Convert.ToString(rowId);
        }

        bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
        string employeeName = (dao.GetEmployeeName(bean)).EmployeeName;
        //发送信息
        SendMessage("员工" + employeeName + "的" + this.bonusPenalty.SelectedItem + "申请已经确认，烦请领导审批！", this.dropCheckEmp.SelectedValue);

        //提示成功
        Response.Write("<script language=JavaScript>" +
                 "alert('" + HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0037").ToString().Replace("{0}", "提交") + "');</script>");

    }

    /*名称： btnAmount_Click
     *功能： 审批
     *参数： 
     *返回： 无
     *说明： 无
     */
    protected void btnAmount_Click(object sender, EventArgs e)
    {
        ComValidateChecker validator = new ComValidateChecker();

        //数据验证
        validator.Add(new CheckRequired(txtTime.Text, new ComMessage("E0082", new string[] { "奖惩时间" })));
        validator.Add(new CheckDate(txtTime.Text, new ComMessage("E0037", "奖惩时间")));
        validator.Add(new CheckDouble(txtAmount.Text, 9, 2, new ComMessage("E0036", new string[] { "金额" })));

        //验证没通过
        if (!validator.DoValidator())
        {
            ((Design_MasterPage)this.Master).InfoMessage = validator.ErrorMessage;
            return;
        }
        SysUserManager manager = new SysUserManager(Context);
        string userId = manager.getSysUserBean().getMstSysUserBean().SysUserId;
        PersonBonusPenaltyBean bean = new PersonBonusPenaltyBean();
        PersonBonusPenaltyDao dao = new PersonBonusPenaltyDao();

        //审批时候
        if (!string.IsNullOrEmpty(Convert.ToString(this.ViewState["ROW_ID"])))
        {
            PersonBonusPenaltyBean dataDean = new PersonBonusPenaltyBean();
            
            bean.RowId = Convert.ToInt32(this.ViewState["ROW_ID"]);
            dataDean = dao.GetPersonBonusPenalty(bean);
            bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
            bean.BeginDate = dataDean.BeginDate;
            if (!string.IsNullOrEmpty(txtAmount.Text)) bean.Amount = Convert.ToDecimal(txtAmount.Text);
            bean.HortationType = bonusPenalty.SelectedValue;
            bean.CommitFlg = 1;
            bean.CommitId = dataDean.CommitId;
            bean.CommitMemo = dataDean.CommitMemo;
            if (rdoOk.Checked == true)
            {
                bean.AuditingFlg = 1;
                bean.CancelFlg = 0;
            }
            bean.AuditingId = dataDean.AuditingId;
            bean.AuditingMemo = txtAuditing.Text;
            if (rdoCancel.Checked == true)
            {
                bean.AuditingFlg = 0;
                bean.CancelFlg = 1;
            }     
            bean.UserId = userId;
            dao.UpdPersonBonusPenalty(bean);

        }
        bean.EmployeeId = Convert.ToString(this.ViewState["EMPLOYEE_ID"]);
        string employeeName = (dao.GetEmployeeName(bean)).EmployeeName;
        bean.RowId = Convert.ToInt32(this.ViewState["ROW_ID"]);
        bean = dao.GetPersonBonusPenalty(bean);
        if (bean.AuditingFlg == 1)
        {
            //发送信息
            SendMessage("员工" + employeeName + "的" + this.bonusPenalty.SelectedItem + "申请审批已经通过!", bean.CommitId);
        }
        else
        {
            SendMessage("员工" + employeeName + "的" + this.bonusPenalty.SelectedItem + "申请审批已经撤消!", bean.CommitId);
        }
        //提示成功
        Response.Write("<script language=JavaScript>" +
                 "alert('" + HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0037").ToString().Replace("{0}", "审批") + "');</script>");

        
    }

    /*名称： btnBack_Click
     *功能： 返回
     *参数： 
     *返回： 无
     *说明： 无
     */
    protected void btnBack_Click(object sender, EventArgs e)
    {
        Context.Items["PERSON_ID"] = this.ViewState["PERSON_ID"];
        Context.Items["EMPLOYEE_ID"] = this.ViewState["EMPLOYEE_ID"];
        Context.Items["CMB_JOB_ID"] = ViewState["CMB_JOB_ID"];
        Context.Items["CMB_GROUP_ID"] = ViewState["CMB_GROUP_ID"];
        Context.Items["CMB_STATUS_ID"] = ViewState["CMB_STATUS_ID"];
        Context.Items["ParamPageIndex"] = ViewState["ParamPageIndex"];
        Context.Items["URL"] = ViewState["URL"];
        Context.Items["EMPLOYEE_STATUS"] = ViewState["EMPLOYEE_STATUS"];
        string directUrl = "~/App/Input/PersonBonusPenaltyForm.aspx";

        //返回
        ControllerUtils.Transfer(this.Context, directUrl, false);
    }

    /*名称： SendMessage
     *功能： 发送短信
     *参数： msg 短信内容, employeeId 短信内容地址
     *返回： 无
     *说明： 无
     */
    private void SendMessage(string msg, string employeeId)
    {
        SysUserManager manager = new SysUserManager(Context);
        SysUserBean sysUserBean = manager.getSysUserBean();
        MstSysUserBean mstSysUserBean =
            sysUserBean == null ? null : sysUserBean.getMstSysUserBean();
        MstEmployeeBean mstEmpBean =
            sysUserBean == null ? null : sysUserBean.getEmployeeBean();
        string loginId = mstSysUserBean == null ? "" : mstSysUserBean.SysUserId;
        string emplyId = mstSysUserBean == null ? "" : mstSysUserBean.EmployeeId;

        MessageBean beanMsg = new MessageBean();
        beanMsg.Subject = "奖惩申请确认" + DateUtils.convertToString(DateTime.Now);
        beanMsg.Message = DateUtils.convertToString(DateTime.Now) + msg;
        beanMsg.MessageType = 3;
        beanMsg.SendDate = DateTime.Now;
        beanMsg.ReplyFlag = false;
        beanMsg.ReaderHistoryFlag = false;
        beanMsg.ImportantFlag = false;
        beanMsg.EmployeeId = emplyId;
        beanMsg.UserId = loginId;
        CommonSendMessageUtils sendMsg = new CommonSendMessageUtils(beanMsg, employeeId);
        sendMsg.SendMessage();
    }
}
